#include <stdio.h>
#include <stdlib.h>

typedef int ElementType;
typedef struct Node *PtrToNode;

struct Node {
    ElementType Data;
    PtrToNode   Next;
};
typedef PtrToNode List;

int main()
{
    int k,m;
    scanf("%d",&k);
    List L,p;
    L=(PtrToNode)malloc(sizeof(struct Node));
    L->Next=NULL;
    while(scanf("%d",&m)&&m>=0){
        p=(PtrToNode)malloc(sizeof(struct Node));
        p->Data=m;
        p->Next=L->Next;
        L->Next=p;
    }
    for(int i=0;i<k;i++){
        L=L->Next;
    }
    if(L!=NULL){
        printf("%d",L->Data);
    }else{
        printf("NULL");
    }
    return 0;
}
